]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
cleanup: Disambiguate assignments in arrow functions
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 19 Aug 2019 20:20:35 +0000 (22:20 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Sun, 15 Sep 2019 14:02:45 +0000 (16:02 +0200)
As arrow functions have an implicit return value, an assignment of
this.foo = bar could have been intended as a this.foo === bar
comparison. To catch those errors, we will disallow these kinds
of assignments unless they are marked explicitly by an extra pair
of parentheses.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/731

14 files changed:
js/misc/jsParse.js
js/perf/hwtest.js
js/ui/accessDialog.js
js/ui/appDisplay.js
js/ui/audioDeviceSelection.js
js/ui/components/networkAgent.js
js/ui/dateMenu.js
js/ui/modalDialog.js
js/ui/ripples.js
js/ui/status/network.js
js/ui/status/system.js
js/ui/status/thunderbolt.js
js/ui/windowManager.js
js/ui/workspacesView.js

index 43e99cabcf305a89d3ea2eaaabd5cb0720003bd3..8cfff1659a81a06b26c99fa4a8b3654e4356b95d 100644 (file)
@@ -172,7 +172,7 @@ function getPropertyNamesFromExpression(expr, commandHeader = '') {
 
         // Make sure propsUnique contains one key for every
         // property so we end up with a unique list of properties
-        allProps.map(p => propsUnique[p] = null);
+        allProps.map(p => (propsUnique[p] = null));
     }
     return Object.keys(propsUnique).sort();
 }
index be7392984d7475472cf5eb7f0b30d0163212b9da..5b8934332d97c48d0d5de10635932f8265e3d230 100644 (file)
@@ -57,7 +57,7 @@ function waitAndDraw(milliseconds) {
             cb();
     });
 
-    return callback => cb = callback;
+    return callback => (cb = callback);
 }
 
 function waitSignal(object, signal) {
@@ -69,7 +69,7 @@ function waitSignal(object, signal) {
             cb();
     });
 
-    return callback => cb = callback;
+    return callback => (cb = callback);
 }
 
 function extractBootTimestamp() {
index 06321407bd16081750ae8c384fa13baf769bb395..30389eda4671004b985c9939f644a90c83be9869 100644 (file)
@@ -147,7 +147,7 @@ var AccessDialogDBus = class {
                                       subtitle, body, options);
         dialog.open();
 
-        dialog.connect('closed', () => this._accessDialog = null);
+        dialog.connect('closed', () => (this._accessDialog = null));
 
         this._accessDialog = dialog;
     }
index b98781db08449f8c1cc4f3e2a736c9fe9e09f2b6..d61329fd4dbdcce90a182a6e73e7183f4a82fb5f 100644 (file)
@@ -505,7 +505,7 @@ var AllView = class AllView extends BaseAppView {
                 opacity: 0,
                 duration: VIEWS_SWITCH_TIME,
                 mode: Clutter.AnimationMode.EASE_OUT_QUAD,
-                onComplete: () => this.opacity = 255
+                onComplete: () => (this.opacity = 255)
             });
 
         if (animationDirection == IconGrid.AnimationDirection.OUT)
index 232307eea42fa276032ed892a9138564eee7dc3f..a5097216d87e50999db7222b1f38f6009e3470aa 100644 (file)
@@ -161,7 +161,7 @@ var AudioDeviceSelectionDBus = class AudioDeviceSelectionDBus {
 
         let [deviceNames] = params;
         let devices = 0;
-        deviceNames.forEach(n => devices |= AudioDevice[n.toUpperCase()]);
+        deviceNames.forEach(n => (devices |= AudioDevice[n.toUpperCase()]));
 
         let dialog;
         try {
index f037ef783b1148bba981d1888c4f90e18a8d628c..9e1063d2b329ab7a8d20947f14289835b0522754 100644 (file)
@@ -624,7 +624,7 @@ var NetworkAgent = class {
         this._pluginDir = Gio.file_new_for_path(Config.VPNDIR);
         try {
             let monitor = this._pluginDir.monitor(Gio.FileMonitorFlags.NONE, null);
-            monitor.connect('changed', () => this._vpnCacheBuilt = false);
+            monitor.connect('changed', () => (this._vpnCacheBuilt = false));
         } catch (e) {
             log(`Failed to create monitor for VPN plugin dir: ${e.message}`);
         }
index cfe52091f06b5d1f25df512255d565334bba1817..9a086de477e3378ad721a446f05dafc8c8e31480 100644 (file)
@@ -413,7 +413,7 @@ var MessagesIndicator = class MessagesIndicator {
 
     _updateCount() {
         let count = 0;
-        this._sources.forEach(source => count += source.unseenCount);
+        this._sources.forEach(source => (count += source.unseenCount));
         count -= Main.messageTray.queueCount;
 
         this.actor.visible = (count > 0);
index 1d2c694dc9615549637a640825e1ef148f3e8fb2..1eeb15a956a95a2d42e2c73ab48e7b5de3b2aa41 100644 (file)
@@ -253,7 +253,7 @@ var ModalDialog = GObject.registerClass({
             opacity: 0,
             duration: FADE_OUT_DIALOG_TIME,
             mode: Clutter.AnimationMode.EASE_OUT_QUAD,
-            onComplete: () => this.state = State.FADED_OUT
+            onComplete: () => (this.state = State.FADED_OUT)
         });
     }
 });
index 99c1dfc533396e62d65d18d56d804a060155b6cc..458501d4afbbddd12945dfe9d2815373ed954ecc 100644 (file)
@@ -67,7 +67,7 @@ var Ripples = class Ripples {
             delay,
             duration,
             mode: Clutter.AnimationMode.LINEAR,
-            onComplete: () => ripple.visible = false
+            onComplete: () => (ripple.visible = false)
         });
     }
 
index 5d939648f6a5e938ef80110f36fece4c390ca6c7..e7512122a72947fd4a4b281d86c3d795196cf82c 100644 (file)
@@ -1676,7 +1676,7 @@ var NMApplet = class extends PanelMenu.SystemIndicator {
                                                   'network-transmit-receive');
             this._source.policy = new MessageTray.NotificationApplicationPolicy('gnome-network-panel');
 
-            this._source.connect('destroy', () => this._source = null);
+            this._source.connect('destroy', () => (this._source = null));
             Main.messageTray.add(this._source);
         }
     }
index e353e8fbaac6ba24192d684a6badc08b8119a319..8ca04481e0ac8ce98dfc65b2878c3eeb4b37e09e 100644 (file)
@@ -33,7 +33,7 @@ var AltSwitcher = class {
 
         this.actor = new St.Bin();
         this.actor.connect('destroy', this._onDestroy.bind(this));
-        this.actor.connect('notify::mapped', () => this._flipped = false);
+        this.actor.connect('notify::mapped', () => (this._flipped = false));
     }
 
     _sync() {
index e4de032a9f2963ae68b9babc83c20b1c02121fb4..23b437daf4fcb99eb452fc8a41d417d8bf9974bd 100644 (file)
@@ -260,7 +260,7 @@ var Indicator = class extends PanelMenu.SystemIndicator {
         if (!this._source) {
             this._source = new MessageTray.Source(_("Thunderbolt"),
                                                   'thunderbolt-symbolic');
-            this._source.connect('destroy', () => this._source = null);
+            this._source.connect('destroy', () => (this._source = null));
 
             Main.messageTray.add(this._source);
         }
index 29727884916334e609402f4895027f8d6239e4ce..11837c46a7b0a42163d5afc628c0c85cb65e2302 100644 (file)
@@ -1114,7 +1114,7 @@ var WindowManager = class {
 
     _showPadOsd(display, device, settings, imagePath, editionMode, monitorIndex) {
         this._currentPadOsd = new PadOsd.PadOsd(device, settings, imagePath, editionMode, monitorIndex);
-        this._currentPadOsd.connect('closed', () => this._currentPadOsd = null);
+        this._currentPadOsd.connect('closed', () => (this._currentPadOsd = null));
 
         return this._currentPadOsd.actor;
     }
index 8c1ba81a6dfb7b7159c13aec4ff8b6a1850ea737..172d2d49053d737144b777e9820676d3a230fab1 100644 (file)
@@ -247,7 +247,7 @@ var WorkspacesView = class extends WorkspacesViewBase {
         this.scrollAdjustment.ease(index, {
             mode: Clutter.AnimationMode.EASE_OUT_QUAD,
             duration: WORKSPACE_SWITCH_TIME,
-            onComplete: () => this._animatingScroll = false
+            onComplete: () => (this._animatingScroll = false)
         });
     }